import {profiler, _decorator} from "cc";
import {DEBUG} from "cc/env";
import {oops} from "db://oops-framework/core/Oops";
import {Root} from "db://oops-framework/core/Root";
import {smc} from "db://assets/script/game/common/singletonModuleComp";
import {ecs} from "db://oops-framework/libs/ecs/ECS";
import {InitializeSystem} from "db://assets/script/game/initialize/initialize";
import {UIConfigData} from "db://assets/script/game/common/config/gameUiConfig";
import {DatingSystem} from "db://assets/script/game/dating/dating";
import {CommonSystem} from "db://assets/script/game/common/system";
import {MjSystem} from "db://assets/script/game/majiang/system";
import {MjEntity} from "db://assets/script/game/majiang/entity";
import {Initialize} from "db://assets/script/game/initialize/entity";
import {DatingEntity} from "db://assets/script/game/dating/entity";

const { ccclass, property } = _decorator

@ccclass('Main')
export class Main extends Root {
    start() {
        if (DEBUG) profiler.showStats();
    }

    protected run() {
        smc.initialize = ecs.getEntity<Initialize>(Initialize)
        // 大厅
        smc.dating = ecs.getEntity<DatingEntity>(DatingEntity)
        smc.gameMj = ecs.getEntity<MjEntity>(MjEntity)
    }

    protected initGui() {
        oops.gui.init(UIConfigData)
    }

    protected initEcsSystem() {
        oops.ecs.add(new InitializeSystem())
        // 通用系统
        oops.ecs.add(new CommonSystem())
        // 大厅
        oops.ecs.add(new DatingSystem())
        // 麻将
        oops.ecs.add(new MjSystem())
    }
}